//
//  FancinatingTableCell.m
//  HappyBaby
//
//  Created by lanou on 15/11/25.
//  Copyright © 2015年 华哥. All rights reserved.
//

#import "FancinatingTableCell.h"
#import "UIImageView+WebCache.h"
@implementation FancinatingTableCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseIdentifier];
    if (self) {
        // 初始化加载FancinatingTableCell.xib
        NSArray *arrayOfViews = [[NSBundle mainBundle] loadNibNamed:@"FancinatingTableCell" owner:self options:nil];
        // 如果路径不存在 return nil
        if (arrayOfViews.count < 1) {
            return nil;
        }
        // 如果xib中的View不属于UItableViewCell类，return nil
        if (![[arrayOfViews objectAtIndex:0] isKindOfClass:[UITableViewCell class]]) {
            return  nil;
        }
        
        // 加载nib
        self = [arrayOfViews objectAtIndex:0];
    }
    return  self;
}

- (void)setModel:(FancinatingModel *)model
{
    _model = model;
    [self.iconImageView sd_setImageWithURL:[NSURL URLWithString:model.theme_image] placeholderImage:[UIImage imageNamed:@"placeHoldImage6"]];
    self.themeTitle.text = model.theme_title;
    self.themeExcerpt.text = model.theme_excerpt;
}









- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
